package com.yeung.exam;


import java.util.Scanner;

/**
 * Created by zmt on 2016/12/22.
 */
public class 条件元组 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int count = sc.nextInt();
        int index = 0;
        int[] nums = new int[count];
        while (index < count)
            nums[index++] = sc.nextInt();
        if (nums.length <= 1) {
            System.out.println(0);
            return;
        }
        //准备好了数据
        int max = Integer.MIN_VALUE;
        for (int i = 0; i < count; i++) {
            for (int k = i; k < count; k++) {
                if (nums[i] <= nums[k]) {
                    int height = Math.abs(i-k);
                    if (height > max)
                        max = height;
                }
            }
        }
        System.out.println(max);
    }


}